package com.vimi8.ebb.auth.api;

import com.vimi8.ebb.auth.configuration.HttpResponseEntity;
import com.vimi8.ebb.auth.model.Token;
import com.vimi8.ebb.auth.model.LoginUser;

import io.swagger.annotations.*;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringCodegen", date = "2016-09-12T05:46:07.581Z")

@RestController
@Api(value = "login", description = "the login API")
public interface LoginApi {

    @ApiOperation(value = "登录接口", notes = "通过后台发送token验证,确保client_secret不在APP端或浏览器端泄露,且接口使用图片验证码防止机器猜解.", response = Token.class, tags={ "注册登录", })
    @ApiResponses(value = { 
        @ApiResponse(code = 200, message = "成功,返回token对象", response = Token.class),
        @ApiResponse(code = 200, message = "失败,返回消息", response = Token.class) })
    @RequestMapping(value = "/login/",
        produces = { "application/json" },
        method = RequestMethod.POST)
    HttpResponseEntity<Token> loginPost(

            @ApiParam(value = "登录所需的用户信息", required = true) @RequestBody LoginUser loginUser
            , HttpServletRequest request
    );


    @ApiOperation(value = "图像验证码", notes = "获取图像验证码的同时,在session里写入验证码的值.", response = Void.class, tags={ "注册登录", })
    @ApiResponses(value = { 
        @ApiResponse(code = 200, message = "成功,返回图像验证码图片", response = Void.class) })
    @RequestMapping(value = "/login/verifyCode.jpg",
        method = RequestMethod.GET)
    HttpResponseEntity<Void> loginVerifyCodeJpgGet(HttpServletRequest req, HttpServletResponse resp);

}
